#ifndef _CLOCK_H_
#define _CLOCK_H_


#include "../bitpointer/BitPointer.h"
#include "../device/Device.h"
#include "../counter/Counter.h"

/*
	class : Clock
	desc : Creates a clock using a bitpointer and a counter
		the counter tells when when the clock signal
		is notted and the bitpointer points to the 
		bit acting as the clock.
*/
class Clock : public Device
{
	private:
		//the counter used to determine when to invert the clock.
		Counter<unsigned char> counter;
		//the pointer to the bit acting as the clock.
		BitPointer clock;
		
	public:
		//constructor takes in counter and bitpointer
		Clock(Counter<unsigned char>& count, BitPointer& c); 
		//constructor takes in period and a bitpointer
		Clock(unsigned char p, BitPointer& c);
		//default constructor of the clock.
		Clock();
		//sets the period of the clock to p
		void setPeriod(unsigned char p);
		//gets the period of the clock.
		unsigned char getPeriod();
		//gets the pointer to the clock.
		BitPointer getPointer();
		//sets the value of the clock
		void setValue(unsigned char v);
		//runs the clock
		void run();
};


#endif
